package com.landtool.lanbase.database.service.impl;

import com.landtool.lanbase.database.entity.TargetAreaManagement;
import com.landtool.lanbase.database.mapper.TargetAreaManagementMapper;
import com.landtool.lanbase.database.service.TargetAreaManagementService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TargetAreaManagement)表服务实现类
 *
 * @author lizhao
 * @since 2019-07-03 14:29:29
 */
@Service("targetAreaManagementService")
public class TargetAreaManagementServiceImpl implements TargetAreaManagementService {
    @Resource
    private TargetAreaManagementMapper targetAreaManagementMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param objectid 主键
     * @return 实例对象
     */
    @Override
    public TargetAreaManagement queryById(Integer objectid) {
        return this.targetAreaManagementMapper.queryById(objectid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TargetAreaManagement> queryAllByLimit(int offset, int limit) {
        return this.targetAreaManagementMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param targetAreaManagement 实例对象
     * @return 实例对象
     */
    @Override
    public TargetAreaManagement insert(TargetAreaManagement targetAreaManagement) {
        this.targetAreaManagementMapper.insert(targetAreaManagement);
        return targetAreaManagement;
    }
    
    /**
     * 新增部分数据
     *
     * @param targetAreaManagement 实例对象
     * @return 实例对象
     */
    @Override
    public TargetAreaManagement insertSelective(TargetAreaManagement targetAreaManagement) {
        this.targetAreaManagementMapper.insertSelective(targetAreaManagement);
        return targetAreaManagement;
    }

    /**
     * 修改数据
     *
     * @param targetAreaManagement 实例对象
     * @return 实例对象
     */
    @Override
    public TargetAreaManagement update(TargetAreaManagement targetAreaManagement) {
        this.targetAreaManagementMapper.update(targetAreaManagement);
        return this.queryById(targetAreaManagement.getObjectid());
    }

    /**
     * 通过主键删除数据
     *
     * @param objectid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer objectid) {
        return this.targetAreaManagementMapper.deleteById(objectid) > 0;
    }

    @Override
    public List <TargetAreaManagement> queryAll(TargetAreaManagement targetAreaManagement) {
        return this.targetAreaManagementMapper.queryAll(targetAreaManagement);
    }
}